package other

import java.io.{PrintWriter, File}


object FileMatcher {

  def withPrintWriter(file: File, op: PrintWriter => Unit) {
    val pw = new PrintWriter(file)
    try {
      op(pw)
    } finally {
      pw.close()
    }
  }



  def main(args : Array[String]) {
    withPrintWriter(new File("date.txt"), writer => writer.println(new java.util.Date))
  }



}
